package com.example.model.log.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.example.annotations.Autowired;
import com.example.annotations.Service;
import com.example.db.SqlBuilder;
import com.example.db.TableService;
import com.example.db.model.IPage;
import com.example.model.log.LogModel;
import com.example.model.log.service.LogModelService;

/**
 * @Classname LogModelServiceImpl
 * @Description TODO
 * @Date 2022/8/14 12:10
 * @Created by XiongXiong
 * @Author: X.I.O
 */
@Service
public class LogModelServiceImpl implements LogModelService {

    @Autowired
    TableService tableService;

    public IPage<LogModel> logModelPage(Integer pageNum, Integer pageSize, JSONObject object){
        SqlBuilder sqlBuilder=tableService.getSqlBuilder(LogModel.class);
        if(object != null){

        }
        sqlBuilder.orderByDesc("createdate");
        sqlBuilder.page(pageNum,pageSize);
        return tableService.getPage(sqlBuilder,LogModel.class);
    }


    @Override
    public LogModel saveLogModel(LogModel logModel) {
        return tableService.save(logModel,LogModel.class);
    }
}
